﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Drawing {
	/// <summary>
	/// Defines a rectangular clipping of output in actual canvas units rounded to nearest pixel.
	/// </summary>
	public class Clipping {
		private Rect _clippingRect;

		/// <summary>
		/// Initializes a new instance of the <see cref="Clipping"/> class.
		/// </summary>
		/// <param name="clippingRect">The clipping rect.</param>
		public Clipping(Rect clippingRect) {
			_clippingRect = clippingRect;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="Clipping"/> class.
		/// </summary>
		/// <param name="x">The x of left top point of clipping rect.</param>
		/// <param name="y">The y of left top point of clipping rect.</param>
		/// <param name="width">The width of clipping rect.</param>
		/// <param name="height">The height of clipping rect.</param>
		public Clipping(float x, float y, float width, float height) {
			_clippingRect = Rect.FromBox(x, y, width, height);
		}

		/// <summary>
		/// Gets the clipping rect.
		/// </summary>
		/// <value>The clipping rect.</value>
		public Rect ClippingRect {
			get { return _clippingRect; }
		}

		/// <summary>Defines disabled clipping</summary>
		public static readonly Clipping None = null;
	}
}
